package com.example.entity;

import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
public class RechargeRecord {
    private Long id;
    
    private Long userId;
    
    private String username;
    
    private BigDecimal rechargeAmount; // 充值金额
    
    private BigDecimal beforeBalance; // 充值前余额
    
    private BigDecimal afterBalance; // 充值后余额
    
    private String rechargeType; // 充值类型：MANUAL-手动充值，AUTO-自动充值，ADMIN-管理员充值
    
    private String paymentMethod; // 支付方式：BALANCE-余额，ALIPAY-支付宝，WECHAT-微信
    
    private String orderNo; // 订单号
    
    private String transactionId; // 第三方交易ID
    
    private Integer status; // 充值状态：0-失败，1-成功，2-处理中
    
    private String remark; // 备注
    
    private Long operatorId; // 操作员ID（管理员充值时使用）
    
    private String operatorName; // 操作员姓名
    
    private LocalDateTime createTime;
    
    private LocalDateTime updateTime;
    
    private Integer deleted;
    
    // 便捷方法
    public boolean isSuccess() {
        return this.status != null && this.status == 1;
    }
    
    public boolean isFailed() {
        return this.status != null && this.status == 0;
    }
    
    public boolean isProcessing() {
        return this.status != null && this.status == 2;
    }
    
    public void setSuccess() {
        this.status = 1;
    }
    
    public void setFailed() {
        this.status = 0;
    }
    
    public void setProcessing() {
        this.status = 2;
    }
}
